package com.hspedu.newData.dmsxl.数组;
/**
 * @Author: yh
 * @description: 
 * @CreateTime: 2025-04-30 
 * @Version: 1.0
 */

public class LC2643一最多的行 {

    // todo 耗时很长
    public int[] rowAndMaximumOnes(int[][] mat) {

        int count = 0;
        int k = mat.length;
        for (int i = mat.length - 1; i >= 0; i--) {
            int[] nums = mat[i];
            int temp = 0;
            for (int j = 0; j < nums.length; j++) {
                if (nums[j] == 1){
                    temp++;
                }
            }
            if (temp >= count){
                k = i;
                count = temp;
            }
        }
        return new int[]{k,count};
    }
}
